<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="hevea 2.18">
<link rel="stylesheet" type="text/css" href="manual.css">
<title>Chapter&#XA0;33&#XA0;&#XA0;The dynlink library: dynamic loading and linking of object files</title>
</head>
<body>
<a href="libgraph.html"><img src="previous_motif.gif" alt="Previous"></a>
<a href="index.html"><img src="contents_motif.gif" alt="Up"></a>
<a href="libbigarray.html"><img src="next_motif.gif" alt="Next"></a>
<hr>
<h1 class="chapter" id="sec559">Chapter&#XA0;33&#XA0;&#XA0;The dynlink library: dynamic loading and linking of object files</h1>
<p>The <span class="c003">dynlink</span> library supports type-safe dynamic loading and linking
of bytecode object files (<span class="c003">.cmo</span> and <span class="c003">.cma</span> files) in a running
bytecode program, or of native plugins (usually <span class="c003">.cmxs</span> files) in a
running native program. Type safety is ensured by limiting the set of
modules from the running program that the loaded object file can
access, and checking that the running program and the loaded object
file have been compiled against the same interfaces for these modules.
In native code, there are also some compatibility checks on the
implementations (to avoid errors with cross-module optimizations); it
might be useful to hide <span class="c003">.cmx</span> files when building native plugins so
that they remain independent of the implementation of modules in the
main program.</p><p>Programs that use the <span class="c003">dynlink</span> library simply need to link
<span class="c003">dynlink.cma</span> or <span class="c003">dynlink.cmxa</span> with their object files and other libraries. </p><ul class="ftoc2"><li class="li-links">
<a href="libref/Dynlink.html">Module <span class="c003">Dynlink</span>: dynamic loading of bytecode object files</a>
</li></ul>
<hr>
<a href="libgraph.html"><img src="previous_motif.gif" alt="Previous"></a>
<a href="index.html"><img src="contents_motif.gif" alt="Up"></a>
<a href="libbigarray.html"><img src="next_motif.gif" alt="Next"></a>
</body>
</html>
